<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <title>register demo</title>
  <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
  <link rel="stylesheet" type="text/css" href="index.css">
<body>
<div id="container" class="cm-content">
  <div id="register">
    <div class="header">
      <div class="go left">
        <a>
          <i class="fa fa-long-arrow-left"></i>
        </a>
        <span>快速注册</span>
      </div>
      <div class="login right">
        <a>登录</a>
      </div>
    </div>
    <div class="register">
      <div class="form">
        <div class="input">
          <i class="fa fa-user"></i>
          <input name="" type="text"  :placeholder="type.id == 0 ? '请输入邮箱': '请输入手机号'"/>
        </div>
        <div class="input">
          <i class="fa fa-lock"></i>
          <input name="" type="password" placeholder="请输入密码" />
        </div>
        <div class="input">
          <i class="fa fa-lock"></i>
          <input name="" type="password" placeholder="请再输入一次密码" />
        </div>
        <div class="code" v-show="type.id == 1">
          <div class="input left">
            <i class="fa fa-lock"></i>
            <input name="" type="password" placeholder="请再输入验证码" />
          </div>
          <div class="button right">
            <button>验证码</button>
          </div>
        </div>
        <div class="button">
          <button>注册</button>
        </div>
        <div class="text">
          <a v-text="type.text" @click="typeChange"></a>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
<script type="text/javascript" src="vue.js"></script>
<script type="text/javascript">
  var vm = new Vue({
    el: '#register',
    data: {
      type: {
        id: 0,
        text: '使用手机号注册'
      }
    },
    methods: {
      typeChange: function() {
        if(this.type.id == 0) {
          this.type.id = 1;
          this.type.text = '使用邮箱注册';
        } else if(this.type.id == 1) {
          this.type.id = 0;
          this.type.text = '使用手机号注册';
        }
      }
    }
  });
</script>
</html>